package com.Extends.Interface;

public class AnimalDemo {
    public static void main(String[] args){
        //猫
        Animal a1 = new Cat();
        a1.setName("加菲猫");
        a1.setAge(5);
        System.out.println(a1.getName()+","+a1.getAge());
        a1.eat();
//        a1.jump();
        ((Cat)a1).jump();
        Jumping a2 = new Cat();
        a2.jump();

        /*接口多态和抽象类多态只能调用它里面有的，Animal只能调用eat,
        不能调用jump。
         */

        System.out.println("------------------------------");
        Cat c = new Cat("加菲猫",5);
        System.out.println(c.getName()+","+c.getAge());
        c.eat();
        c.jump();

    }
}
